const { Article } = require('../../model/article');
const pagination = require('mongoose-sex-page');
module.exports = async(req, res) => {
    // 用户页面标识
    req.app.locals.currentLink = 'article';
    
    // 查询所有文章数据,多集合联合查询
    // const articledata = await Article.find().populate('author').lean();
    const page = req.query.page || 1;
    let data = await pagination(Article).page(page).size(2).display(3).populate('author').exec();
     let str = JSON.stringify(data);
     let articledata = JSON.parse(str);
    res.render('admin/article', {
        articledata
    });
    
}